import {defineConfig, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path";

export default defineConfig(({mode}) => {
  //  加载环境配置
  const env = loadEnv(mode, process.cwd())

  return {
    server: {
      port: env.VITE_SERVER_PORT
    },
    plugins: [vue()],
    resolve: {
      alias: {
        '@': path.resolve(__dirname, './src') // 将 @ 映射到 src 目录
      }
    },
  }
})
